package com.enjoyor.soa.traffic.rest.tsms.dubbo.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.enjoyor.soa.traffic.api.dto.tsms.RltRoutePostDto;
import com.enjoyor.soa.traffic.api.service.dubbo.tsms.IDubboRltRoutePostService;
import com.enjoyor.soa.traffic.rest.tsms.dubbo.IRltRoutePostConsumeService;
import com.enjoyor.soa.traffic.util.helper.JsonHelper;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@Component
public class RltRoutePostConsumeService implements IRltRoutePostConsumeService{

	@Reference(version = "1.0.0", timeout = 10000)
	//@Reference(version = "1.0.0", timeout = 10000, url="dubbo://192.168.56.8:21241")
	private IDubboRltRoutePostService iDubboRltRoutePostService;

	@Override
	public ResultPojo getRouteRltPostPage(Page page, String taskId, String routeId, String postId, String isHandle) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.getRouteRltPostPage(page, taskId, routeId, postId, isHandle);
		return resultPojo;
	}

	@Override
	public ResultPojo getRouteRltPostList(String taskId, String routeId, String postId, String isHandle) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.getRouteRltPostList(taskId, routeId, postId, isHandle);
		return resultPojo;
	}

	@Override
	public ResultPojo deleteRouteRltPost(String postId, String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.deleteRouteRltPost(postId, personName);
		return resultPojo;
	}

	@Override
	public ResultPojo updateRouteRltPost(RltRoutePostDto rltRoutePostDto, String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.updateRouteRltPost(rltRoutePostDto, personName);
		return resultPojo;
	}

	@Override
	public ResultPojo insertRouteRltPost(RltRoutePostDto rltRoutePostDto, String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.insertRouteRltPost(rltRoutePostDto, personName);
		return resultPojo;
	}

	@Override
	public ResultPojo rltRoutePostList(List<RltRoutePostDto> list, String taskId, String routeId, String personName) {
		// TODO Auto-generated method stub
		//List<RltRoutePostDto> postDtoList = JSONArray.parseArray(list, RltRoutePostDto.class);
		ResultPojo resultPojo = new ResultPojo();
		resultPojo = iDubboRltRoutePostService.rltRoutePostList(list, taskId, routeId, personName);
		return resultPojo;
	}
}
